function P=def_calc_pos_ang(G,P,k)
% def_calc_pos_ang: Default subroutine to extract position and angle from P.Vars
%
% SYNTAX:
%   P = def_calc_pos_ang(G,P,k)
%   Return the player object with fields 'pos' and 'ang' extracted from P.Vars
%   Game object G and player index k are passed also for convenience of using other players' info.
%   You can provide your own routine following the calling syntax here.
%   Such routine will be needed if player has a motion specified by ordinary differential equation (ODE).

%   Author: Hongbin Ma
%   Last updated: 2009-6-1 with MATLAB 6.5
%   Problems or suggestions? Email me: mathmhb[at]163.com

switch length(P.pos)
case 2
P.pos=[P.Vars(1:2)];
P.ang=[P.Vars(3)];
case 3
P.pos=[P.Vars(1:3)];
P.ang=[P.Vars(4:6)];
otherwise,
alert_error_pos(P.pos);
end;

